Linux System Monitoring: Basic Tools and Performance Metrics
Linux system monitoring is fundamental for ensuring server stability and requires mastery of tools and metrics. Common tools include: process monitoring (`ps` for basic viewing, `top` for real-time dynamics, `htop` for tree-like structure/mouse operations); memory (`free -h` to check memory/cache, focusing on `available` and Swap); disk (`df -h` for partition inspection, `du -sh` for directory location, `iostat -x 1` for IO monitoring with `%util > 80%` indicating bottlenecks); and network (`ss -tuln` for port checking, `ss -s` for connection status). Key metrics: CPU load (should not exceed core count within 1 minute) and `wa` (high values indicate disk bottlenecks); memory should alert on Swap usage; disk monitoring requires cleaning when partition usage exceeds 85%. For system lag diagnosis: first use `top` to check load/CPU, then `free` for memory, `df` for disk confirmation, and `ss` to排查异常 connections. Through the "observe-analyze-optimize" cycle with tools and metrics, regular practice enables rapid problem localization and system stability maintenance.
Read More